<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<!-- 
		Replace path to template, title, header and body
		with actual data.
	 -->
<ui:composition template="../template/layout.xhtml">
	<ui:define name="titulo">#{locPaisController.tituloPagina}</ui:define>

	<ui:define name="frConteudo">
		<h:form id="form">
			<h:outputText escape="false" value="#{msg.geralListaVazia}"
				rendered="#{locPaisController.listaPaises.rowCount == 0}" />

			<p:dataTable id="tabela" var="bean"
				value="#{locPaisController.listaPaises}" paginator="true" rows="5"
				rendered="#{locPaisController.listaPaises.rowCount > 0}">

				<f:facet name="header">
						<h:outputLabel value="#{locPaisController.tituloPagina}" /> 
					</f:facet>

				<f:facet name="footer">
				</f:facet>

				<p:column sortBy="#{bean.code}" filterBy="#{bean.code}">
					<f:facet name="header">
						<h:outputText value="#{msg.locPaisCode}" />
					</f:facet>
					<h:outputText value="#{bean.code}" />
				</p:column>

				<p:column sortBy="#{bean.pais}" filterBy="#{bean.pais}">
					<f:facet name="header">
						<h:outputText value="#{msg.locPais}" />
					</f:facet>
					<h:outputText value="#{bean.pais}" />
				</p:column>

				<p:column sortBy="#{bean.activo}">
					<f:facet name="header">
						<h:outputText value="#{msg.locPaisActivo}" />
					</f:facet>
					<h:selectBooleanCheckbox value="#{bean.activo}" disabled="true" />
					<h:outputText value="#{bean.activo}" />
				</p:column>

				<p:column>
					<h:panelGroup>
						<p:commandLink update="form:display"
							oncomplete="beanDialog.show()">
							<h:graphicImage library="imagens" name="detalhes20.png"
								style="border:0" />
							<h:outputText value="#{msg.geralLinkDetalhes}" />
							<f:setPropertyActionListener
								target="#{locPaisController.infoBean}" value="#{bean}" />
						</p:commandLink>
						<h:outputText value="  " />
						<h:commandLink action="#{locPaisController.preparaEditar}">
							<h:graphicImage library="imagens" name="editar16a.png"
								style="border:0" />
							<h:outputText value="#{msg.geralLinkAlterar}" />
							<f:setPropertyActionListener
								target="#{locPaisController.infoBean}" value="#{bean}" />
						</h:commandLink>
						<h:outputText value="  " />
						<h:commandLink action="#{locPaisController.preparaEliminar}">
							<h:graphicImage library="imagens" name="deletar16a.png"
								style="border:0" />
							<h:outputText value="#{msg.geralLinkEliminar}" />
							<f:setPropertyActionListener
								target="#{locPaisController.infoBean}" value="#{bean}" />
						</h:commandLink>
					</h:panelGroup>
				</p:column>

			</p:dataTable>

			<!-- area de exportação -->
			<h:panelGrid columns="2"
				rendered="#{locPaisController.listaPaises.rowCount > 0}">
				<p:panel header="Exportar tudo">
					<h:commandLink>
						<h:graphicImage library="imagens" name="excel.png"
							style="border:0" />
						<p:dataExporter type="xls" target="tabela"
							fileName="#{locPaisController.tituloPagina}" excludeColumns="3" />
					</h:commandLink>

					<h:commandLink>
						<h:graphicImage library="imagens" name="pdf.png" style="border:0" />
						<p:dataExporter type="pdf" target="tabela"
							fileName="#{locPaisController.tituloPagina}" excludeColumns="3" />
					</h:commandLink>

					<h:commandLink>
						<h:graphicImage library="imagens" name="excel.png"
							style="border:0" />
						<p:dataExporter type="csv" target="tabela"
							fileName="#{locPaisController.tituloPagina}" excludeColumns="3" />
					</h:commandLink>

					<h:commandLink>
						<h:graphicImage library="imagens" name="pdf.png" style="border:0" />
						<p:dataExporter type="xml" target="tabela"
							fileName="#{locPaisController.tituloPagina}" excludeColumns="3" />
					</h:commandLink>
				</p:panel>

				<p:panel header="Exportar página">
					<h:commandLink>
						<h:graphicImage library="imagens" name="excel.png"
							style="border:0" />
						<p:dataExporter type="xls" target="tabela"
							fileName="#{locPaisController.tituloPagina}" pageOnly="true"
							excludeColumns="3" />
					</h:commandLink>

					<h:commandLink>
						<h:graphicImage library="imagens" name="pdf.png" style="border:0" />
						<p:dataExporter type="pdf" target="tabela"
							fileName="#{locPaisController.tituloPagina}" pageOnly="true"
							excludeColumns="3" />
					</h:commandLink>

					<h:commandLink>
						<h:graphicImage library="imagens" name="excel.png"
							style="border:0" />
						<p:dataExporter type="csv" target="tabela"
							fileName="#{locPaisController.tituloPagina}" pageOnly="true"
							excludeColumns="3" />
					</h:commandLink>

					<h:commandLink>
						<h:graphicImage library="imagens" name="pdf.png" style="border:0" />
						<p:dataExporter type="xml" target="tabela"
							fileName="#{locPaisController.tituloPagina}" pageOnly="true"
							excludeColumns="3" />
					</h:commandLink>
				</p:panel>
			</h:panelGrid>

			<!-- <br /> -->

			<h:panelGroup>
				<h:commandLink action="#{locPaisController.preparaAdicionar}"
					immediate="true">
					<h:graphicImage library="imagens" name="adicionar16a.png"
						style="border:0" />
					<h:outputText value="#{msg.geralLinkNovoRegisto}" />
					<f:setPropertyActionListener target="#{locPaisController.infoBean}"
						value="#{bean}" />
				</h:commandLink>
				<h:outputText value="  " />
				<h:commandLink action="#{locPaisController.voltar}" immediate="true"
					value="#{msg.geralInicio}" />
			</h:panelGroup>

			<!-- area de detalhes width="200"  -->
			<p:dialog header="#{msg.locPaisTituloDetalhes}"
				widgetVar="beanDialog" resizable="false" showEffect="explode"
				hideEffect="explode">

				<h:panelGrid id="display" columns="2" cellpadding="4">

					<h:outputText value="#{msg.locPaisId}:" />
					<h:outputLabel value="#{locPaisController.infoBean.id}" />

					<h:outputText value="#{msg.locPaisCode}:" />
					<h:outputLabel value="#{locPaisController.infoBean.code}" />

					<h:outputText value="#{msg.locPais}:" />
					<h:outputLabel value="#{locPaisController.infoBean.pais}" />

					<h:outputText value="#{msg.locPaisActivo}:" />
					<h:selectBooleanCheckbox
						value="#{locPaisController.infoBean.activo}" disabled="true" />

					<h:outputText value="#{msg.locPaisDataRegisto}:" />
					<h:outputLabel value="#{locPaisController.infoBean.dataRegisto}" />

					<h:outputText value="#{msg.locPaisOperadorRegisto}:" />
					<h:outputLabel
						value="#{locPaisController.infoBean.operadorRegisto}" />

					<h:outputText value="#{msg.locPaisDataAlteracao}:" />
					<h:outputLabel value="#{locPaisController.infoBean.dataAlteracao}" />

					<h:outputText value="#{msg.locPaisOperadorAlteracao}:" />
					<h:outputLabel
						value="#{locPaisController.infoBean.operadorAlteracao}" />
				</h:panelGrid>
			</p:dialog>
			<!-- fim da area de detalhes -->
		</h:form>
	</ui:define>
</ui:composition>
</html>